<h1>JavaScript needs frameworks</h1>

<pre class="sh_javascript left">
var result = [];
var tab = document.getElementsByTagName("div");
for (var i=0; i&lt;tab.length; i++)‏
	if (/.*[\s^]myClass[\s$].*/
	  .match(tab[i].styleClass)) 
		var tmp = tab[i].childNodes;
for (var j=0; j&lt;tmp.length; j++)‏
	if (/.*[\s^]myOtherClass[\s$].*/
	  .match(tmp[i].styleClass))
		result.push(tmp[i]);
for (var i=0; i&lt;result.length; i++)‏
	result[i].addClassName("invisible");
</pre>

<pre class="sh_javascript right">
$$("div.myClass .myOtherClass")‏
  .invoke("addClassName", "invisible");
</pre>

<br class="clear"/>

<p>
	We could do the same to:
	<ul>
		<li>Listen to custom events</li>
		<li>Manage object inheritance</li>
		<li>Deal with Ajax requests…</li>
	</ul>
</p>

<p>The left-hand (pure javascript) example may not be cross-navigator compliant whereas the right-hand (Prototype based) is.</p>

